1. Field of Invention
The invention relates to a charge detection device and method and, in particular, to a charge detection device and method for measuring the charge capacity of a battery.
2. Related Art
The measurement of voltage output from a battery in the prior art mostly utilizes a voltage divider. The voltage at a detecting point is sent to a microprocessor for comparison to detect the charge capacity of the battery. As shown in FIG. 1, the voltage Vcc of the battery provides the work power for the microprocessor 11. The voltage VR2 is extracted from the voltage divider through resistor R2. When the voltage of the battery drops, the voltage VR2 also decreases. The input detection pin I of the microprocessor 11 is mainly used to receive the voltage VR2. When the voltage VR2 received by the detection pin is lower than a lower threshold voltage in the microprocessor 11, i.e. when the detection pin changes from a logic H to a logic L, then the charge capacity of the battery is insufficient. Although the above-mentioned method can easily measure the charge capacity of the battery, such a detection circuit using partial resistors may result in a leaking current 12, wasting the energy of the battery.
With reference to FIGS. 2A and 2B, since the detection circuit in FIG. 1 results in a leaking current, another method was proposed to connect the ground terminal GND of the resistor R2 to the output pin O of the microprocessor 11. The detection device uses a program to set the initial value of the output pin O of the microprocessor 11 as a logic high H (with a potential Vcc), so that no leaking current occurs to the resistor circuit. When the microprocessor 11 measures the charge capacity of a battery, the output pin O of the microprocessor 11 switches from a logic high H to the logic low L (i.e. GND). The input terminal I of the microprocessor uses the above-mentioned partial voltage principle to measure the charge capacity of the battery. After the measurement is done, the output pin O is returned to the logic high H. As shown in FIG. 2B, the battery capacity detection device has the function of sectional charge measurements. The microprocessor 11 uses several input terminal pins I1, I2 and I3 to measure the partial voltages to measure the charge capacity during the drop of the voltage output of the battery.
Although the charge detection device shown in FIGS. 2A and 2B can effectively avoid the occurrence of leaking currents, the microprocessor 11 employed has more pins. Therefore, even though the microprocessor 11 can use more resources to measure the capacity of the battery, the function of the microprocessor 11 often cannot be fully utilized.
A primary objective of the invention is to provide a battery capacity detection device and method to measure the work voltage and charge using the RC charging time and a look-up table.
Another objective of the invention is to provide a battery capacity detection device. Using the combination of an RC circuit and a microprocessor, only a single pin of the microprocessor is needed to detect the battery charge capacity in a continuous way.
In view of the problems of leaking currents and more microprocessor I/O pins in the conventional battery capacity detection device, the invention proposes a battery charge detection method. The battery charges an RC-loop and the charging time reflects the charge of the battery. The method includes the steps of: forming a discharge loop for the capacitor of the RC-loop until the capacitor discharges down to level 0; and measuring the time needed for the battery to charge the RC-loop until the capacitor is charged to a designated level so that the current charge capacity of the battery can be computed.
In accordance with a battery capacity detection device disclosed herein, it includes an RC-loop consisting of a battery, a resistor R and a capacitor C; and a microprocessor; wherein the microprocessor utilizes a work-mode programmable pin to measure the capacitor C in the RC-loop. When the microprocessor measures the charge of the battery, the programmable pin of the microprocessor is in the output mode, outputting a low level to form a discharge loop until the capacitor discharges to level 0. Afterwards, the programmable pin is set to the input mode to measure the time needed for the pin to transit from the low level to a high level. This is the charge time for the capacitor in the RC-loop to be charged from level 0 to the high level. The charge capacity of the battery is then computed from the charge time.
According to a preferred embodiment of the invention, the battery capacity detection method needs an RC-loop consisting of a battery, a resistor R and a capacitor C and a microprocessor with a programmable pin. The method includes the steps of: turning the microprocessor pin from an input mode to an output mode; having the programmable pin output a low level so that the capacitor in the RC-loop discharges to level 0; turning the microprocessor pin from the output mode to the input mode; and computing by the microprocessor the time needed for the pin to make the transition from the low level to a high level. The charging time needed for the pin to make the transition from the low level to a high level is used to compute the charge capacity of the battery.